/**
 * 订单管理 交易订单
 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>交易订单</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 搜索筛选 -->
    <el-form :inline="true" :model="formInline" class="user-search">
      <el-form-item label="搜索：">
        <el-input size="small" v-model="formInline.tnumber" placeholder="输入终端编号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="small" v-model="formInline.orderId" placeholder="输入订单号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="small" v-model="formInline.dealId" placeholder="输入交易单号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select size="small" v-model="formInline.mode" placeholder="请选择支付方式">
          <el-option v-for="type in mode" :label="type.name" :value="type.id" :key="type.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select size="small" v-model="formInline.stat" placeholder="请选择订单状态">
          <el-option v-for="type in stat" :label="type.name" :value="type.id" :key="type.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" icon="el-icon-setting" @click="reset">重置</el-button>
        <el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </el-form-item>
      <el-form-item>
        <el-button v-if="this.opRight.includes('save')" size="small" type="primary" icon="el-icon-plus"
                   @click="handleEdit()">添加</el-button>
      </el-form-item>

    </el-form>
    <!--列表-->
    <el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
      <el-table-column align="center" type="index" width="60">
      </el-table-column>
      <el-table-column sortable prop="tnumber" label="终端编号" width="120" align="center"  show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="orderId" label="订单号" width="120" align="center"  show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="dealId" label="交易单号" width="120" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="name" label="支付方式" width="80" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="dealMode" label="交易类型" width="80"  align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="goodsPrice" label="商品价格" width="80" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="payAmount" label="支付金额" width="80"  align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="goodsName" label="商品名称" width="120" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="statName" label="订单状态" width="100" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="addTime" label="创建时间" width="160" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <div>{{scope.row.addTime|timestampToTime}}</div>
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="250">
        <template slot-scope="scope">
          <el-button v-if="opRight.includes('look')" size="mini" @click="handleEdit(scope.$index, scope.row)">预览</el-button>
          <el-button v-if="opRight.includes('refund')" size="mini" type="danger" @click="orderRefund(scope.$index, scope.row)">退款</el-button>
          <el-button v-if="opRight.includes('delete')" size="mini" type="danger" @click="deleteOrder(scope.$index, scope.row)">删除此订单</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>

    <!-- 编辑界面 -->
    <el-dialog :title="title" :visible.sync="editFormVisible" width="50%" @click="closeDialog('editForm')">

      <el-form label-width="120px" :model="editForm" ref="editForm" rules="rules">
        <el-row>
          <el-col :span="12">

            <el-form-item label="订单号" prop="orderId">
              <el-input size="small" v-model="editForm.orderId" auto-complete="off" placeholder="请输入订单号" :disabled="this.title==='预览'"></el-input>
            </el-form-item>
            <el-form-item label="交易类型" prop="dealMode">
              <el-select size="small" v-model="editForm.dealMode" placeholder="请输入交易类型" @change="changePrice" :disabled="this.title==='预览'">
                <el-option v-for="type in dealMode" :label="type.name" :value="type.name" :key="type.id"></el-option>
              </el-select>
            </el-form-item>

            <span  style="color: #ff4d51" v-show="deptFlag">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
              &nbsp没有此部门编号</span>
            <el-form-item label="部门编号" prop="deptId">
              <el-input size="small" v-model="editForm.deptId" auto-complete="off" placeholder="请输入部门编号" :disabled="this.title==='预览'"
                    @change="getDept"></el-input>
            </el-form-item>

            <span  style="color: #ff4d51" v-show="tnumberFlag">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
              &nbsp没有此终端编号</span>
            <el-form-item label="终端编号" prop="tnumber">
              <el-input size="small" v-model="editForm.tnumber" auto-complete="off" placeholder="请输入终端编号" :disabled="this.title==='预览'"
                    @change="getCnfinfo"></el-input>
            </el-form-item>

            <el-form-item label="支付方式">
              <el-input size="small" v-model="editForm.mode" auto-complete="off" placeholder="请输入支付方式" :disabled="true"></el-input>
            </el-form-item>

            <el-form-item label="子支付方式">
              <el-input size="small" v-model="editForm.subName" auto-complete="off" placeholder="请输入子支付方式" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="商品价格">
              <el-input size="small" v-model="editForm.goodsPrice" auto-complete="off" placeholder="请输入商品价格" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="子商户号">
              <el-input size="small" v-model="editForm.subCode" auto-complete="off" placeholder="请输入子商户号" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="加密类型">
              <el-input size="small" v-model="editForm.encryptionMode" auto-complete="off" placeholder="请输入加密类型" :disabled="true"></el-input>
            </el-form-item>
          </el-col>




          <el-col :span="12">
            <el-form-item label="交易单号" prop="dealId">
              <el-input size="small" v-model="editForm.dealId" auto-complete="off" placeholder="请输入交易单号" :disabled="this.title==='预览'"></el-input>
            </el-form-item>
<!--            <el-form-item label="交易类型">-->
<!--              <el-input size="small" v-model="editForm.dealMode" auto-complete="off" placeholder="请输入交易类型" :disabled="this.title==='预览'"></el-input>-->
<!--            </el-form-item>-->

            <el-form-item label="订单状态" prop="stat">
              <el-select size="small" v-model="editForm.stat" placeholder="请选择订单状态" :disabled="this.title==='预览'">
                <el-option v-for="type in stat" :label="type.name" :value="type.id" :key="type.id"></el-option>
              </el-select>
            </el-form-item>


            <span v-show="productFlag"  style="color: #ff4d51">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
              &nbsp没有此商品编号</span>
            <el-form-item label="商品编号" prop="productId">
              <el-input size="small" v-model="editForm.productId" auto-complete="off" placeholder="请输入商品编号" :disabled="this.title==='预览'"
               @change="getGoods"></el-input>
            </el-form-item>

            <span v-show="merchantFlag"  style="color: #ff4d51">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
              &nbsp没有此商户号</span>
              <el-form-item label="商户号" prop="merchantCode">
                <el-input size="small" v-model="editForm.merchantCode" auto-complete="off" placeholder="请输入商户号" :disabled="this.title==='预览'"
                          @change="getCnf"></el-input>
              </el-form-item>

            <el-form-item label="支付金额">
              <el-input size="small" v-model="editForm.payAmount" auto-complete="off" placeholder="请输入支付金额" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="部门名称">
              <el-input size="small" v-model="editForm.deptName" auto-complete="off" placeholder="请输入部门名称" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="商品名称">
              <el-input size="small" v-model="editForm.goodsName" auto-complete="off" placeholder="请输入商品名称" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="商户卖家">
              <el-input size="small" v-model="editForm.merchantName" auto-complete="off" placeholder="请输入卖家" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="商户签名密钥">
              <el-input size="small" v-model="editForm.secretKey" auto-complete="off" placeholder="请输入商户签名密钥" :disabled="true"></el-input>
            </el-form-item>

          </el-col>
        </el-row>
        <el-form-item label="备注">
          <el-input size="small" v-model="editForm.remark" auto-complete="off" placeholder="请输入备注信息" :disabled="this.title==='预览'"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeDialog">取消</el-button>
        <el-button v-if="this.opRight.includes('save')" size="small" type="primary"
                   :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
    OrderList, OrderRefund, OrderDelete,
    ModeList, OrderStat, OrderSave,
    OrderGoods, OrderDeptName, OrderCnfinfo, OrderCnf
  } from '../../api/payMG'
import Pagination from '../../components/Pagination'
  import {UserOpRight} from "../../api/userMG";
  import {lert} from "../../api/axiosFun";
export default {
  data() {
    return {
      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      title: '预览',
      deptFlag:false,
      tnumberFlag: false,
      productFlag:false,
      merchantFlag:false,
      opRight: [],
      login:{
        code: 'deal',
        token:localStorage.getItem('userdata')
      },
      mode: [],
      stat: [],
      dealMode:[
        {id:1,name:'消费'},
        {id: 2, name: '退款'}],
      userdata: JSON.parse(localStorage.getItem('userdata')),
      editForm: {
        id: '',
        deptId: '',
        orderId: '',
        mode: '',
        dealMode: '',
        productId: '',
        payAmount: '',
        encryptionMode: '',
        secretKey: '',
        subCode: '',
        deptName: '',
        dealId: '',
        subName: '',
        tnumber: '',
        goodsPrice: '',
        goodsName: '',
        stat: '',
        merchantCode: '',
        merchantName: '',
        remark: '',
        token: localStorage.getItem('userdata')
      },
      formInline: {
        page: 1,
        limit: 10,
        tnumber: '',
        orderId: '',
        dealId: '',
        mode: '',
        stat: '',
        token: localStorage.getItem('userdata')
      },
      // 删除部门
      seletedata: {
        ids: '',
        token: localStorage.getItem('userdata')
      },
      userparm: [], //搜索权限
      listData: [], //用户数据
      // 分页参数
      pageparm: {
        currentPage: 1,
        pageSize: 10,
        total: 10
      },
      // rules表单验证
      rules: {
        orderId: [
          { required: true, message: '请输入订单号', trigger: 'blur' }
        ],
        dealId: [
          { required: true, message: '请输入交易单号', trigger: 'blur' }
        ],
        dealMode: [
          { required: true, message: '请选择交易类型', trigger: 'blur' }
        ],
        stat: [{ required: false, message: '请选择订单状态', trigger: 'blur' }
        ],
        deptId: [
          { required: true, message: '请输入部门编号', trigger: 'blur' }
        ],
        productId: [
          { required: true, message: '请输入商品编号', trigger: 'blur' }
        ],
        tnumber: [
          { required: true, message: '请输入终端编号', trigger: 'blur' }
        ],
        merchantCode: [
          { required: true, message: '请输入商户号', trigger: 'blur' }
        ]
      },
    }
  },
  // 注册组件
  components: {
    Pagination
  },
  /**
   * 数据发生改变
   */

  /**
   * 创建完毕
   */
  created() {
    this.getMode()
    this.getStat()
    this.getdata(this.formInline)
  },

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {

    //获取支付方式信息
    getMode() {
      ModeList()
      .then(res => {
        lert(res);
          this.mode = JSON.parse(res.data)
        });
    },
    //获取订单状态数组
    getStat() {
      OrderStat()
      .then(res => {
          this.stat = JSON.parse(res.data)
        })
    },
    // 获取部门列表
    getdata(parameter) {
      this.loading = true
      /***
       * 调用接口，注释上面模拟数据 取消下面注释
       */
      //获取当前页面的操作权限(opRight)
      UserOpRight(this.login)
        .then(res=>{
          this.opRight = JSON.parse(res.data);
        })

      OrderList(parameter)
      .then(res => {
          this.loading = false
          if (res.success == false) {
            this.$message({
              type: 'info',
              message: res.msg
            })
          } else {
            var result = JSON.parse(res.data);
            this.listData = result.records
            // 分页赋值
            this.pageparm.currentPage = result.page
            this.pageparm.pageSize = result.size
            this.pageparm.total = result.total
            this.$message.success(res.msg)
          }
        })
        .catch(err => {
          this.loading = false
          this.$message.error('菜单加载失败，请稍后再试！')
        })
    },


    // 分页插件事件
    callFather(parm) {
      this.formInline.page = parm.currentPage
      this.formInline.limit = parm.pageSize
      this.getdata(this.formInline)
    },
    // 搜索事件

    search() {
      this.getdata(this.formInline)
    },
    //重置
    reset() {
      this.formInline.mode = ''
      this.formInline.stat = ''
      this.formInline.tnumber = ''
      this.formInline.orderId = ''
      this.formInline.dealId=''
    },
    //显示预览界面
    handleEdit: function (index, row) {
      if (row != undefined && row != 'undefined') {
        this.title = '预览'
        this.editFormVisible = true
        this.editForm = row
        this.editForm.stat=row.statName
      } else {
        this.title = '添加';
        this.flag=false
        this.editFormVisible = true
        this.editForm.id = ''
        this.editForm.deptId = ''
        this.editForm.orderId = ''
        this.editForm.mode = ''
        this.editForm.dealMode = ''
        this.editForm.productId = ''
        this.editForm.payAmount = ''
        this.editForm.encryptionMode = ''
        this.editForm.secretKey = ''
        this.editForm.subCode = ''
        this.editForm.deptName = ''
        this.editForm.dealId = ''
        this.editForm.subName = ''
        this.editForm.tnumber = ''
        this.editForm.goodsPrice = ''
        this.editForm.goodsName = ''
        this.editForm.stat = ''
        this.editForm.merchantCode = ''
        this.editForm.merchantName = ''
        this.editForm.remark = ''
      }
    },
    // 编辑、增加页面保存方法
    submitForm(editData) {

      this.$refs[editData].validate(valid => {
        if (valid) {
          OrderSave(this.editForm)
          .then(res => {
              lert(res);
              this.editFormVisible = false
              this.loading = false
              if (res.success) {
                this.getdata(this.formInline)
                this.$message({
                  type: 'success',
                  message: '交易订单保存成功！'
                })
              } else {
                this.$message({
                  type: 'info',
                  message: res.msg
                })
              }
            })
            .catch(err => {
              this.editFormVisible = false
              this.loading = false
              this.$message.error('交易订单信息保存失败，请稍后再试！')
            })
        } else {
          return false
        }
      })
    },
    //订单退款
    orderRefund(index, row) {
      this.$confirm('确定要退款吗?', '信息', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
      OrderRefund(row)
      .then(res => {
              lert(res);
          if (res.success) {
            this.getdata(this.formInline);
            this.$message({
              type: 'success',
              message: '订单已退款!'
            });
          } else {
            this.$message.error("退款失败，请稍后再试")
          }
        })
    },

    // 删除订单
    deleteOrder(index, row) {
      this.$confirm('确定要删除吗?', '信息', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          OrderDelete(row.id)
          .then(res => {
              lert(res);
              if (res.success) {
                this.$message({
                  type: 'success',
                  message: '订单已删除!'
                })
                this.getdata(this.formInline)
              } else {
                this.$message({
                  type: 'info',
                  message: res.msg
                })
              }
            })
            .catch(err => {
              this.loading = false
              this.$message.error('订单信息删除失败，请稍后再试！')
            })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    },
    //商户号获取子商户号、商户卖家、加密类型、商户签名秘钥
    getCnf() {
      OrderCnf(this.editForm.merchantCode)
        .then(res=>{
          if (res.success) {
            this.merchantFlag = false
            var result = JSON.parse(res.data);
            this.editForm.subCode = result.subCode;
            this.editForm.merchantName = result.merchantName;
            this.editForm.encryptionMode = result.encryptionMode;
            this.editForm.secretKey = result.secretKey;
          } else {
            this.merchantFlag = true
            this.editForm.secretKey = ''
            this.editForm.encryptionMode = ''
            this.editForm.merchantName=''
            this.editForm.subCode=''
          }

        })
    },
    //通过终端编号获取支付方式、子支付方式
    getCnfinfo() {

      OrderCnfinfo(this.editForm.tnumber)
        .then(res=>{
          if (res.success) {
            this.tnumberFlag=false
            var result = JSON.parse(res.data)
            this.editForm.mode=result.name
            this.editForm.subName=result.subname
          } else {
            this.tnumberFlag = true
            this.editForm.subName=''
            this.editForm.mode=''
          }

        })
    },
    //通过部门id获取部门名称
    getDept() {

      OrderDeptName(this.editForm.deptId)
        .then(res=>{
          if (res.success) {
            this.deptFlag=false
            this.editForm.deptName=JSON.parse(res.data).name
          } else {
            this.deptFlag = true
            this.editForm.deptName=''
          }

        })
    },
    //通过交易类型改变商品价格
    changePrice() {

      if (this.editForm.productId === '') {
        console.log("商品编号还没有输入，不查询");
      } else {
        this.editForm.payAmount = this.editForm.dealMode === 2 ? '-' + this.editForm.goodsPrice : this.editForm.goodsPrice
      }

    },
    //通过商品编号获得相应的商品信息
    getGoods(){

      OrderGoods(this.editForm.productId)
        .then(res=>{
          if (res.success) {
            this.productFlag = false
            var result = JSON.parse(res.data);
            this.editForm.payAmount = this.editForm.dealMode === 2 ? '-' + result.goodsPrice : result.goodsPrice
            this.editForm.goodsPrice = result.goodsPrice
            this.editForm.goodsName = result.goodsName
          } else {
            this.productFlag = true
            this.editForm.payAmount=''
            this.editForm.goodsPrice=''
            this.editForm.goodsName=''
          }

        });
    },
    // 关闭编辑、增加弹出框
    closeDialog(formName) {

      this.editFormVisible = false
      this.$refs[formName].resetFields()
    }
  }

}
  // 模拟数据开始
  // let res = {
  //   code: 0,
  //   msg: null,
  //   count: 23,
  //   data: [
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1526380193000,
  //       editTime: 1526380193000,
  //       // orderId: 109,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: 'xxxx',
  //       dealId: 'xxxx',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '退款',
  //       tnumber: '111111',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: -0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 14,
  //       secretKey: null,
  //       resKey: '111111111111111',
  //       subCode: null,
  //       remark: '不允许从此IP发起交易: 101.81.251.226'
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1526380176000,
  //       editTime: 1526380176000,
  //       deptId: 1,
  //       deptName: 'xxxxxx',
  //       orderId: 'xxxx',
  //       dealId: 'xxxxx',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '退款',
  //       tnumber: 'J1AX904002',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: -0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 14,
  //       secretKey: null,
  //       resKey: '898310154990338',
  //       subCode: null,
  //       remark: '不允许从此IP发起交易: 101.81.251.226'
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1524921444000,
  //       editTime: 1524894094000,
  //       deptId: 1,
  //       deptName: 'xxxxxx',
  //       orderId: 'J1AX90400220180428101723945',
  //       dealId: '4200000137201804287543647891',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '消费',
  //       tnumber: 'J1AX904002',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 7,
  //       secretKey: null,
  //       resKey: '898310154990338',
  //       subCode: null,
  //       remark: '无法找到指定的账单'
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1521307596000,
  //       editTime: 1524641207000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '9300079120180318142634440',
  //       dealId: null,
  //       mode: 0,
  //       subName: '0',
  //       dealMode: '消费',
  //       tnumber: '111111111111111',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 7,
  //       secretKey: null,
  //       resKey: null,
  //       subCode: null,
  //       remark: '1111111111111111111111'
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520195909000,
  //       editTime: 1520195909000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '9300079120180305183828606',
  //       dealId: null,
  //       mode: 0,
  //       subName: '0',
  //       dealMode: '消费',
  //       tnumber: '93000791',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 1,
  //       secretKey: null,
  //       resKey: null,
  //       subCode: null,
  //       remark: null
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520035180000,
  //       editTime: 1520035180000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '4200000056201803031934477774',
  //       dealId: '9300079120180303170851281',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '退款',
  //       tnumber: '222222222222222222',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 8,
  //       secretKey: null,
  //       resKey: '898310154990338',
  //       subCode: null,
  //       remark: null
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520020261000,
  //       editTime: 1520185478000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '9300079120180303175059985',
  //       dealId: '4200000072201803031887274444',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '消费',
  //       tnumber: '93000791',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 7,
  //       secretKey: null,
  //       resKey: '898310154990338',
  //       subCode: null,
  //       remark: '不允许从此IP发起交易: 116.247.119.165'
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520019911000,
  //       editTime: 1520020075000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '9300079120180303174511778',
  //       dealId: '4200000055201803031949877221',
  //       mode: 6,
  //       subName: 'WXPay',
  //       dealMode: '消费',
  //       tnumber: '93000791',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 1,
  //       secretKey: null,
  //       resKey: '898310154990338',
  //       subCode: null,
  //       remark: null
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520019776000,
  //       editTime: 1520019776000,
  //       deptId: 1,
  //       deptName: 'xxxx',
  //       orderId: '9300079120180303174256156',
  //       dealId: null,
  //       mode: 0,
  //       subName: '0',
  //       dealMode: '消费',
  //       tnumber: '93000791',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 1,
  //       secretKey: null,
  //       resKey: null,
  //       subCode: null,
  //       remark: null
  //     },
  //     {
  //       addUser: null,
  //       merchantName: null,
  //       addTime: 1520019729000,
  //       editTime: 1520019729000,
  //       deptId: 1,
  //       deptName: '上海XX',
  //       orderId: '9300079120180303174208429',
  //       dealId: null,
  //       mode: 0,
  //       subName: '0',
  //       dealMode: '消费',
  //       tnumber: '93000791',
  //       productId: '123456',
  //       goodsPrice: 0.01,
  //       payAmount: 0.01,
  //       goodsName: '可乐',
  //       encryptionMode: null,
  //       stat: 1,
  //       secretKey: null,
  //       resKey: null,
  //       subCode: null,
  //       remark: null
  //     }
  //   ]
  // }
  // this.loading = false
  // this.listData = res.data
  // this.pageparm.currentPage = this.formInline.page
  // this.pageparm.pageSize = this.formInline.limit
  // this.pageparm.total = res.count
  // 模拟数据结束
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>





